<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>新增管理员</title>
<link rel="stylesheet" type="text/css" href="views/admin/style/css/basic.css" />
<link rel="stylesheet" type="text/css" href="views/admin/style/css/manager.css" />
<script type="text/javascript" src="views/common/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="views/common/js/artDialog4.1.6/jquery.artDialog.js?skin=idialog"></script>
<script type="text/javascript" src="views/common/js/artDialog4.1.6/plugins/iframeTools.js"></script>
<script type="text/javascript" src="views/common/js/jquery-validation/jquery.validate.js"></script>
<script type="text/javascript" src="views/common/js/jquery-validation/localization/messages_zh.js"></script>
</head>
<body>
<script type="text/javascript">
$(document).ready(function(){
    $("#level").val("<{$oneManage[0]->level}>");
    $("#update_form").validate({
        submitHandler:function(){
        var content = $("#update_form").serialize();
            $.ajax({
                type:"POST",
                async:true,
                url:'?c=manager&m=updateSubmit&id=<{$oneManage[0]->id}>',
                data:content,
                success:function(msg){
                    if(msg == 'success'){
                        art.dialog.tips('管理员修改成功！', 1.5);
                        setTimeout(function(){
                            art.dialog.top.document.location.reload();
                        },1500);
                    } else {
                        art.dialog.tips('管理员修改失败，请稍后重试！', 1.5);
                    }
                }
        
            });
        },
        rules:{
            email: {
			    required: true,
			    email: true
			},
            passwd: {
			    minlength: 6
            },
            passwd2:{
                equalTo: "#passwd"
            },
            level: {
            required: true
            }
        },
        messages: {
            email: {
                required:"请输入您的邮箱地址"
            },
            passwd: {
                minlength: "密码长度不能小于6位"
            },
            passwd2: {
                equalTo: "两次输入的密码不一致"
            },
            level: {
                required: "请选择一个管理员等级"
            }
        },
    });
});
</script>
<form id="update_form" class="form">
<input type="hidden" name="password" value="<{$oneManage[0]->passwd}>" />
    <div class="input_box">
        <div class="entry">
            <label for="user" class="title">用户名：</label>
            <span class="notice">*</span>
            <input type="text" name="user" class="form_input" disabled="disabled" value="<{$oneManage[0]->user}>"/>
            <label class="error" for="user">用户名不得修改</label>
        </div>
        <div class="entry">
            <label for="email" class="title">Email地址：</label>
            <span class="notice">*</span>
            <input type="text" name="email" class="form_input" value="<{$oneManage[0]->email}>" />
        </div>
        <div class="entry">
            <label for="passwd" class="title">密码：</label>
            <span class="notice">*</span>
            <input type="password" id="passwd" name="passwd" class="form_input"/>
        </div>
        <div class="entry">
            <label for="passwd2" class="title">密码确认：</label>
            <span class="notice">*</span>
            <input type="password" id="passwd2" name="passwd2" class="form_input"/>
        </div>
        <div class="entry">
            <label for="level" class="title">等级：</label>
            <span class="notice">*</span>
                <select name="level" id="level">
                    <option value="">--请选择一个等级权限--</option>
                    <{html_options options=$allLevel}>
                </select>
        </div>
    </div>
        <div style="margin-left:160px;">
            <button type="submit" class="button">修改</button>
        </div>
</form>
</body>
</html>